﻿<Application
    x:Class="Unread.App.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Unread.App"
    xmlns:common="using:Unread.App.Common"
    xmlns:converters="using:Unread.App.Converters">

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>

                <!-- 
                    Styles that define common aspects of the platform look and feel
                    Required by Visual Studio project and item templates
                 -->
                <ResourceDictionary Source="Common/StandardStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>

            <x:String x:Key="AppName">Unread</x:String>
            <converters:BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" />
            <converters:HtmlToTextConverter x:Key="htmlToTextConverter" />
            <converters:NullToBooleanConverter x:Key="nullToBooleanConverter" />
            <converters:ItemViewModelToImageConverter x:Key="itemViewModelToImageConverter" />
            <converters:UnreadFeedItemViewModelToImageConverter x:Key="unreadFeedItemViewModelToImageConverter" />
            <converters:BackgroundToRandomColorConverter x:Key="backgroundToRandomColorConverter" />

            <DataTemplate x:Key="UnreadFeedItemTemplate">
                <Grid HorizontalAlignment="Left" MinWidth="250" MinHeight="250" Background="{Binding Converter={StaticResource backgroundToRandomColorConverter}}">
                    <Border>
                        <Image Source="{Binding Converter={StaticResource unreadFeedItemViewModelToImageConverter}}" Stretch="Uniform" AutomationProperties.Name="{Binding Title}"/>
                    </Border>
                    <StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}">
                        <TextBlock Text="{Binding Title, Converter={StaticResource htmlToTextConverter}}" Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}" Style="{StaticResource TitleTextStyle}" Height="60" Margin="15,0,15,0"/>
                        <TextBlock Text="{Binding Subtitle, Converter={StaticResource htmlToTextConverter}}" Foreground="{StaticResource ListViewItemOverlaySecondaryForegroundThemeBrush}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,0,15,10"/>
                    </StackPanel>
                </Grid>
            </DataTemplate>
            <DataTemplate x:Key="FeedTemplate">
                <Grid HorizontalAlignment="Left" Width="250" Height="250" Background="{Binding Converter={StaticResource backgroundToRandomColorConverter}}">
                    <Border>
                        <Image Source="{Binding Image}" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/>
                    </Border>
                    <StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}">
                        <TextBlock Text="{Binding Title}" Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}" Style="{StaticResource TitleTextStyle}" Height="60" Margin="15,0,15,0"/>
                        <TextBlock Text="{Binding Subtitle}" Foreground="{StaticResource ListViewItemOverlaySecondaryForegroundThemeBrush}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,0,15,10"/>
                    </StackPanel>
                </Grid>
            </DataTemplate>
        </ResourceDictionary>
    </Application.Resources>
</Application>
